(function () {
	var navWindow;
	
	var pathimage=Ti.App.Properties.getString('pathimage');

//	alert(pathimage)
	var i=0,bottom_bt=40,space=50,top=50
	
	
	//var win = Titanium.UI.currentWindow;
	var win = Ti.UI.createWindow({
		exitOnClose: true,
     	backgroundColor:'#e3e3e3',
        navBarHidden:true,
        fullscreen:true,
       // backgroundImage: pathimage+'panel_right.png',
        title:'Màn hình chính',
      
        orientationModes:[
	        Titanium.UI.LANDSCAPE_LEFT,
	        Titanium.UI.LANDSCAPE_RIGHT,
		]
		
    });
    var egc = new globals.EventGarbageCollection(win);
    /////////////LOGIN///////////////////////////////
	var header = Ti.UI.createView({
	   
	    top: 0,
	    height:50,
	    width:'100%',
	    touchEnabled: true,
	    backgroundImage: pathimage+'bg_blue.png',
	});
	win.add(header);
	var lb1 = Ti.UI.createLabel({
	  	text:'HỆ THỐNG QUẢN LÝ NHÀ HÀNG-CÀ PHÊ-QUÁN BAR',
	  	color:'white',
	  	font:{
				fontSize:Ti.App.Properties.getInt('fontsize_header'),
				fontWeight:'bold',
		},
	});
	header.add(lb1);
	/////////////LOGIN///////////////////////////////
	var login=require('controls/login').Createlogin({
	 		top:header.height,
		    
    })

	win.add(login);
  
	egc.addEventListener('MainWindow:login', function (e) {
		//alert('LOGIN MODULE')
		Lhs.navGroup.open(Lhs.ui.CreateSettingWindow({
				
		}), 
		{
		    animated: true,
		    navBarHidden:true
		});	
	})
	
	// handle cross-platform navigation
    if (Lhs.isAndroid()) {
        Lhs.navGroup = {
            open: function (win, obj) {
                win.open(obj);
            },
            close: function (win, obj) {
                win.close(obj);
            }
        };
        navWindow = win;
    } else {
        navWindow = Ti.UI.createWindow();
        Lhs.navGroup = Ti.UI.iPhone.createNavigationGroup({
            window: win
        });
        navWindow.add(Lhs.navGroup);
    }

	
	//Titanium.UI.orientation = Titanium.UI.LANDSCAPE_LEFT;
	///////////////////LOADING//////////////////////
	if (Lhs.isAndroid()) {
		//LANDSCAPE Mode//
		/*
		win.orientationModes = [
		    Titanium.UI.LANDSCAPE_LEFT
		]; 
		Titanium.UI.orientation = Titanium.UI.LANDSCAPE_LEFT;
		*/
        win.open({
            animated: true
        });
    } else {
    	//LANDSCAPE Mode//
    	/*
    	navWindow.orientationModes = [
		    Titanium.UI.LANDSCAPE_LEFT
		]; 
		Titanium.UI.orientation = Titanium.UI.LANDSCAPE_LEFT;
	   */
	
        navWindow.open({
            transition: Ti.UI.iPhone.AnimationStyle.CURL_DOWN
        });
    }
	

})();









